home *** CD-ROM | disk | FTP | other *** search
/ Shareware Extravaganza - Disc 4 / Shareware Extravaganza - Over 25,000 Programs (The Ultimate Shareware Company)(Disc 4 of 4)(1993).iso / cad / edittxt.zip / EDITTXT.LSP < prev   
Text File  |  1990-12-27  |  2KB  |  92 lines

  1. (defun c:edittxt ()
  2.      (setq pick (entsel "\nPICK TEXT: "))
  3.      (if (= "TEXT" (cdr (assoc 0 (setq e (entget (car pick))))))
  4.     (progn
  5.     (setq otext (cdr (setq as (assoc 1 e))))
  6.     (princ (strcat "\n>" otext))
  7.     (princ "\n>_")
  8.     (setq edit "")
  9.     (setq pos 1)
  10.     (if (= (car (setq in (grread))) 2) (setq ch (cadr in)) (setq ch 0))
  11.     (while (/= ch 13)
  12.        (cond
  13.           ((= ch 8)
  14.          (if (> pos 1)
  15.              (progn
  16.             (princ (strcat (chr 8) (chr 8) "_"))
  17.             (setq pos (1- pos))
  18.             (setq edit (substr edit 1 (1- pos)))
  19.              )
  20.          )
  21.           )
  22.           ((and (> ch 31) (< ch 127))
  23.          (if (< pos 80)
  24.             (progn
  25.                (setq edit (strcat edit (chr ch)))
  26.                (setq pos (1+ pos))
  27.                (princ (strcat (chr 8) (chr ch) "_"))
  28.             )
  29.          )
  30.           )
  31.        )
  32.        (if (= (car (setq in (grread))) 2) (setq ch (cadr in)) (setq ch 0))
  33.     )
  34.     (while (> (strlen edit) 0)
  35.        (princ (chr 8))
  36.        (setq ntxt "")
  37.        (setq i 1)
  38.        (setq ch " ")
  39.        (while (and (<= i (strlen edit)) (/= ch "["))
  40.           (setq ch (substr edit i 1))
  41.           (cond
  42.          ((= ch " ") (if (> i (strlen otext))
  43.             (setq ntxt (strcat ntxt " "))
  44.             (setq ntxt (strcat ntxt (substr otext i 1)))
  45.          ))
  46.          ((= ch "^") (setq ntxt (strcat ntxt " ")))
  47.          ((= ch "[") (setq ntxt (strcat ntxt (substr edit (1+ i)))))
  48.          ((/= ch "\\") (setq ntxt (strcat ntxt ch)))
  49.           )
  50.           (if (/= ch "[") (setq i (1+ i)))
  51.        )
  52.        (if (<= i (strlen otext))
  53.           (setq ntxt (strcat ntxt (substr otext i))))
  54.        (setq otext ntxt)
  55.        (princ (strcat "\n>" otext))
  56.  
  57.     (princ "\n>_")
  58.     (setq edit "")
  59.     (setq pos 1)
  60.     (if (= (car (setq in (grread))) 2) (setq ch (cadr in)) (setq ch 0))
  61.     (while (/= ch 13)
  62.        (cond
  63.           ((= ch 8)
  64.          (if (> pos 1)
  65.              (progn
  66.             (princ (strcat (chr 8) (chr 8) "_"))
  67.             (setq pos (1- pos))
  68.             (setq edit (substr edit 1 (1- pos)))
  69.              )
  70.          )
  71.           )
  72.           ((and (> ch 31) (< ch 127))
  73.          (if (< pos 80)
  74.             (progn
  75.                (setq edit (strcat edit (chr ch)))
  76.                (setq pos (1+ pos))
  77.                (princ (strcat (chr 8) (chr ch) "_"))
  78.             )
  79.          )
  80.           )
  81.        )
  82.        (if (= (car (setq in (grread))) 2) (setq ch (cadr in)) (setq ch 0))
  83.     )
  84.  
  85.     )
  86.     (setq e (subst (cons 1 ntxt) as e))
  87.     (entmod e)
  88.      ))
  89.      ()
  90. )
  91. (edittxt)
  92.